<template>
  <div class="common-layout">
    <el-container>
      <el-aside :width="aSideWidth">
        <div class="logo">
          <img src="../../../assets/logo.svg"> 言㐱陪诊 大数据展示系统
        </div>
        <el-menu
            default-active="1"
            class="el-menu-vertical-demo"
            background-color="#262626"
            router="router"
            text-color="#fff"
            :collapse="collapse"
        >
          <el-menu-item index="home">
            <el-icon>
              <House/>
            </el-icon>
            <span>首页</span>
          </el-menu-item>
          <el-menu-item index="login">
            <template #title>
              <el-icon>
                <IEpMenu/>
              </el-icon>
              <span>切换登录账户</span>
            </template>
          </el-menu-item>
          <el-sub-menu index="2">
            <template #title>
              <el-icon>                <user/>              </el-icon>
              <span>陪诊护士管理</span>
            </template>
            <el-menu-item index="escort">护士基本信息管理</el-menu-item>
            <!--            <el-menu-item index="doctorShow">护士数据展示</el-menu-item>-->
          </el-sub-menu>
          <el-sub-menu index="3">
            <template #title>
              <el-icon>
                <user/>
              </el-icon>
              <span>客户管理</span>
            </template>
            <el-menu-item index="patient">客户基本信息管理</el-menu-item>
            <!--            <el-menu-item index="note">客户就诊信息管理</el-menu-item>-->
          </el-sub-menu>
          <el-sub-menu index="4">
            <template #title>
              <el-icon>
                <Location/>
              </el-icon>
              <span>预约管理</span>
            </template>
            <el-menu-item index="appointment">预约表信息管理</el-menu-item>
            <el-menu-item index="appointment2">预约表信息管理2</el-menu-item>
          </el-sub-menu>
          <el-sub-menu index="5">
            <template #title>
              <el-icon>
                <Document/>
              </el-icon>
              <span>服务记录管理</span>
            </template>
            <el-menu-item index="serviceRecord">服务记录表信息管理</el-menu-item>
          </el-sub-menu>
          <el-sub-menu index="6">
            <template #title>
              <el-icon>
                <Setting/>
              </el-icon>
              <span>账号管理</span>
            </template>
            <el-menu-item index="user">全部账号管理</el-menu-item>
            <el-menu-item index="user0">管理员管理</el-menu-item>
            <el-menu-item index="user1">陪诊护士管理</el-menu-item>
            <el-menu-item index="user2">用户管理</el-menu-item>
          </el-sub-menu>

        </el-menu>
      </el-aside>
      <el-container>
        <el-header style="display: flex; justify-content: space-between; align-items: center;">
          <el-icon :size="20" color="#409efc">
            <Fold v-if="!collapse" @click="foldFn"/>
            <Expand v-else @click="expandFn"/>
          </el-icon>
          //头像位置
          <div class="avatar-container">
            <img src="../../../assets/touxiang.png" alt="头像">
          </div>
        </el-header>
        <el-main>
          <router-view></router-view>
        </el-main>
        <el-footer> 专业：计算机科学与技术 班级：计技222班 学号：2022102207 姓名：吴玉海 用于软件工程课程设计</el-footer>
      </el-container>
    </el-container>
  </div>
</template>

<script>
import { Document, Expand, Fold, House, Location, Setting, User } from "@element-plus/icons-vue";
import { Menu as IEpMenu } from "@element-plus/icons-vue";

export default {
  components: {
    Fold,
    Expand,
    User,
    House,
    Setting,
    Document,
    Location,
    IEpMenu
  },
  data() {
    return {
      // 侧边栏的宽度
      aSideWidth: '64px',
      // 是否折叠
      collapse: true,
    };
  },
  methods: {
    // 展开侧边栏
    expandFn() {
      this.collapse = false;
      this.aSideWidth = '250px';
    },
    // 折叠侧边栏
    foldFn() {
      this.collapse = true;
      this.aSideWidth = '64px';
    }
  }
};
</script>

<style scoped>
.common-layout {
  height: 100%;
}

.el-container {
  height: 100%;
}

.el-aside {
  background-color: #262626;
  transition: width 800ms;
}

.logo {
  height: 60px;
  line-height: 60px;
  color: #40b782;
  overflow: hidden;
  padding-left: 12px;
}

.logo img {
  width: 40px;
  vertical-align: middle;
}

.el-menu {
  border: none;
}

.el-header {
  line-height: 60px;
  background-color: #191919;
}

.el-main {
  background-color: #FAFAFA;
}


.el-footer {
  height: 40px;
  line-height: 40px;
  background-color: #F0F2F5;
  color: #262626;
}

.avatar-container {
  img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
  }
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  margin-right: 10px;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}
</style>